Introduction

Project Overview


Introduction to neighborhood change in Seattle, Washington

I chose Seattle as my city topic. With tech industries booming in Seattle, it would be fun to look at the growth and gentrification that has recently accured in the city. The main tasks you will see are:

  • A quick view of the data, including a 5-point summary, histogram, and correlation plot.
  • A regression analysis based on some of the more correlated variables.
  • A clustering analysis showing five major groups of neighborhoods, their descriptions, and their locations.
  • Neighborhood transitions and what the trends tend to be within neighborhood growth.

Data

Empirical Framework

    TRTID10          HousePriceChange   FreignBornChange  
 Min.   :5.303e+10   Min.   :-1.00000   Min.   :-0.72525  
 1st Qu.:5.303e+10   1st Qu.: 0.03668   1st Qu.:-0.04669  
 Median :5.303e+10   Median : 0.04269   Median : 0.23315  
 Mean   :5.304e+10   Mean   : 0.03634   Mean   : 0.37720  
 3rd Qu.:5.306e+10   3rd Qu.: 0.04743   3rd Qu.: 0.63082  
 Max.   :5.306e+10   Max.   : 0.07394   Max.   : 3.56338  
 RecentImmigrantChange PoorEnglishChange VeteranChange     PovertyChange    
 Min.   :-1.000000     Min.   :-1.0000   Min.   :-0.8738   Min.   :-1.0000  
 1st Qu.:-0.398330     1st Qu.:-0.1349   1st Qu.:-0.4658   1st Qu.:-0.1448  
 Median :-0.009266     Median : 0.4349   Median :-0.3310   Median : 0.2342  
 Mean   : 0.234257     Mean   : 0.7734   Mean   :-0.3334   Mean   : 0.4437  
 3rd Qu.: 0.612261     3rd Qu.: 1.2886   3rd Qu.:-0.2079   3rd Qu.: 0.8314  
 Max.   : 5.230302     Max.   :13.2789   Max.   : 0.3927   Max.   : 4.2590  
 PovertyBlackChange PovertyWhiteChange PovertyHispanicChange PopBlackChange   
 Min.   :-1.00000   Min.   :-1.00000   Min.   :-1.0000       Min.   :-1.0000  
 1st Qu.:-1.00000   1st Qu.:-0.31709   1st Qu.:-1.0000       1st Qu.:-0.8785  
 Median :-0.91892   Median : 0.03654   Median :-0.2747       Median :-0.3433  
 Mean   :-0.03567   Mean   : 0.27254   Mean   : 0.6085       Mean   :-0.1297  
 3rd Qu.:-0.02712   3rd Qu.: 0.68369   3rd Qu.: 0.8131       3rd Qu.: 0.2825  
 Max.   :12.65410   Max.   : 5.02735   Max.   :15.8345       Max.   : 3.8932  
 PopHispanicChange PopUnempChange     PopManufactChange  PopSelfEmpChange  
 Min.   :-1.0000   Min.   :-0.80460   Min.   :-0.82110   Min.   :-0.72199  
 1st Qu.:-0.1930   1st Qu.: 0.07387   1st Qu.:-0.36657   1st Qu.:-0.28101  
 Median : 0.2160   Median : 0.50316   Median :-0.16440   Median :-0.07466  
 Mean   : 0.4134   Mean   : 0.68070   Mean   :-0.12080   Mean   : 0.01485  
 3rd Qu.: 0.7691   3rd Qu.: 1.10460   3rd Qu.: 0.06087   3rd Qu.: 0.15405  
 Max.   : 6.3020   Max.   : 4.68180   Max.   : 1.50114   Max.   : 3.54811  
 PopProfChange      FemaleLaborForceChange
 Min.   :-0.53969   Min.   :-0.465319     
 1st Qu.:-0.07884   1st Qu.:-0.073294     
 Median : 0.02785   Median :-0.002758     
 Mean   : 0.04926   Mean   : 0.002509     
 3rd Qu.: 0.16019   3rd Qu.: 0.056557     
 Max.   : 1.08672   Max.   : 0.592032     

This data came from the US census and is of the year 2010 and 2000. This unit of analysis was population. The variables looked at are:

  • Foreign.Born
  • Recent.Immigrant
  • Poor.English
  • Veteran
  • Poverty
  • Poverty.Black
  • Poverty.White
  • Poverty.Hispanic
  • Pop.Black
  • Pop.Hispanic
  • Pop.Unemp
  • Pop.Manufact
  • Pop.SelfEmp
  • Pop.Prof
  • Female.LaborForce

These variables have been modified as well to show the change between 2000 and 2010 in each category. Some of the more promenant variables include Veteran, Poverty.White, Pop.SelfEmp, and Pop.Manufact.

View Data


This data used the original data and found the percent change from 2000 to 2010 in each variable for each county tract. I took the 2010 variable, divided it by the 2000 variable and subtracted one. To look at an example, in the shown data, you can see in the first tract that House Price Change has gone up by 5.3%. You can also see taht Foreign Born decreased by 45.7%.

5-point summary

Statistic Mean St. Dev. Min Max
TRTID10 53,040,288,857.000 12,463,389.000 53,029,970,300 53,061,940,001
HousePriceChange 0.036 0.076 -1.000 0.074
FreignBornChange 0.377 0.644 -0.725 3.563
RecentImmigrantChange 0.234 1.004 -1.000 5.230
PoorEnglishChange 0.773 1.581 -1.000 13.279
VeteranChange -0.333 0.189 -0.874 0.393
PovertyChange 0.444 0.861 -1.000 4.259
PovertyBlackChange -0.036 1.953 -1 13
PovertyWhiteChange 0.273 0.883 -1.000 5.027
PovertyHispanicChange 0.609 2.665 -1.000 15.835
PopBlackChange -0.130 0.921 -1.000 3.893
PopHispanicChange 0.413 1.024 -1 6
PopUnempChange 0.681 0.850 -0.805 4.682
PopManufactChange -0.121 0.343 -0.821 1.501
PopSelfEmpChange 0.015 0.502 -0.722 3.548
PopProfChange 0.049 0.230 -0.540 1.087
FemaleLaborForceChange 0.003 0.139 -0.465 0.592

Here is a 5-point summary of the 10 year change within variables. For example, the average (mean) increase in House Price was 3.6% where the max was 7.4% in one tract. There are some outliers as well. Poverty Black had a max increase of 1,300% and the Povert Hispanic had a max increase of 1,583%. That would be something to look at furthur for accuracy. For some variables, there was a decrease in change. For example, Veterans decreased by an average (mean) of 33.3%.

Histogram


As you can see, the majority of these histograms follow a normal curve including some of the variables of interest such as Labor Force, Manufacturing, Professional, and Veteran. There were others thogh that did not follow a normal curve and were quite skewed such as House Price, Proverty Black, Poverty Hispanic, and Population Black.

Correlation Plot


In this chart yo can see that some variables are collinear such as Foreign Born, Recent Immigration, and Poor English. A strong correlation, possible collinearization, shows for Poverty White and Poverty. Another positive correlation would be Population Black and Poor English. On the opposite end, House Price and Self Employeed show a negative correlation.

Regressions

Regression Model Results

Effect of Community Change on Housing Price Change
Dependent variable:
HousePriceChange
(1) (2) (3)
FreignBornChange 0.003 -0.002 -0.0005
(0.009) (0.010) (0.009)
RecentImmigrantChange 0.002 -0.0004
(0.007) (0.006)
PoorEnglishChange -0.003 -0.002
(0.004) (0.004)
VeteranChange 0.061** 0.053**
(0.027) (0.024)
PovertyChange -0.019*** 0.019** 0.012
(0.007) (0.009) (0.009)
PovertyBlackChange -0.002 -0.0002
(0.003) (0.003)
PovertyWhiteChange -0.046*** -0.035***
(0.008) (0.008)
PovertyHispanicChange -0.002 -0.002
(0.002) (0.002)
PopBlackChange 0.006 0.007 0.005
(0.006) (0.007) (0.006)
PopUnempChange 0.006 0.002
(0.007) (0.006)
PopManufactChange -0.026*
(0.014)
PopSelfEmpChange -0.064***
(0.009)
PopProfChange 0.004
(0.022)
FemaleLaborForceChange 0.006
(0.036)
PopHispanicChange -0.005 -0.004
(0.006) (0.005)
Constant 0.041*** 0.067*** 0.059***
(0.008) (0.011) (0.011)
Observations 190 190 190
R2 0.048 0.211 0.391
Adjusted R2 0.028 0.167 0.339
Residual Std. Error 0.075 (df = 185) 0.070 (df = 179) 0.062 (df = 174)
F Statistic 2.337* (df = 4; 185) 4.781*** (df = 10; 179) 7.455*** (df = 15; 174)
Note: p<0.1; p<0.05; p<0.01

Here, we can see a regression model of the changes within 2000 to 2010. Some of the stronger variabls that stand one would be Veteran Change, Poverty White Change, Population Manufacturin Change, and Population Self Employeed Change. These were all statistically siginificant.

Clustering

Identifying Communities

---------------------------------------------------- 
Gaussian finite mixture model fitted by EM algorithm 
---------------------------------------------------- 

Mclust VEE (ellipsoidal, equal shape and orientation) model with 5 components: 

 log-likelihood   n  df      BIC      ICL
       3947.811 190 203 6830.476 6811.291

Clustering table:
 1  2  3  4  5 
14 81 11 55 29 

Mixing probabilities:
         1          2          3          4          5 
0.07451822 0.41316902 0.06048752 0.29549910 0.15632614 

Means:
                         [,1]        [,2]        [,3]       [,4]        [,5]
Foreign.Born10      0.8366514 0.421151790 0.264531955 0.56764169 0.200898210
Recent.Immigrant10  0.4939923 0.151530840 0.055505767 0.23464913 0.067339900
Poor.English10      0.4963697 0.088248257 0.032357533 0.20868828 0.030722733
Veteran10           0.1256858 0.201352725 0.207211686 0.18125960 0.132544126
Poverty10           0.5942427 0.196405969 0.125284875 0.36446485 0.138579780
Poverty.Black10     0.1819334 0.007538142 0.001567926 0.04587647 0.007409234
Poverty.White10     0.1555615 0.134905653 0.101348012 0.14959577 0.109900661
Poverty.Hispanic10  0.1137959 0.024963015 0.008440034 0.08780347 0.006431054
Pop.Black10         0.1911506 0.018740004 0.007457519 0.07471672 0.013493983
Pop.Hispanic10      0.1203870 0.045366371 0.034410530 0.08856019 0.032808532
Pop.Unemp10         0.2158400 0.107477958 0.091300021 0.12329096 0.073192449
Pop.Manufact10      0.1380576 0.197773054 0.142020774 0.16985653 0.101975246
Pop.SelfEmp10       0.1385198 0.129982243 0.313294131 0.11942585 0.163319217
Pop.Prof10          0.4696998 0.584194592 0.650862790 0.46882838 0.759342370
Female.LaborForce10 0.6617162 0.663718866 0.587786094 0.63491126 0.621590406

Variances:
[,,1]
                    Foreign.Born10 Recent.Immigrant10 Poor.English10
Foreign.Born10        0.4791583549       1.963010e-01    0.115881474
Recent.Immigrant10    0.1963010258       1.200504e-01    0.051669050
Poor.English10        0.1158814740       5.166905e-02    0.066617563
Veteran10            -0.0588254563      -3.067657e-02   -0.015410063
Poverty10            -0.0314615288      -6.956629e-05    0.027138674
Poverty.Black10       0.0028940079      -4.402293e-04    0.003814277
Poverty.White10      -0.0861588254      -2.544742e-02   -0.011001321
Poverty.Hispanic10    0.0222438589       1.323847e-02    0.019977971
Pop.Black10           0.0174785255       6.193892e-03    0.009666985
Pop.Hispanic10        0.0211977658       1.071377e-02    0.014774128
Pop.Unemp10          -0.0127724859      -1.057203e-03    0.005685241
Pop.Manufact10       -0.0214565761      -1.766678e-02   -0.005803094
Pop.SelfEmp10        -0.0001261392      -9.905594e-03   -0.005140340
Pop.Prof10            0.1758740584       5.819146e-02   -0.017065657
Female.LaborForce10   0.0213724159      -4.219398e-03    0.010272132
                       Veteran10     Poverty10 Poverty.Black10 Poverty.White10
Foreign.Born10      -0.058825456 -3.146153e-02    0.0028940079    -0.086158825
Recent.Immigrant10  -0.030676568 -6.956629e-05   -0.0004402293    -0.025447417
Poor.English10      -0.015410063  2.713867e-02    0.0038142774    -0.011001321
Veteran10            0.049586566 -3.442501e-03   -0.0024127135     0.007454440
Poverty10           -0.003442501  1.403299e-01    0.0133763455     0.079984824
Poverty.Black10     -0.002412713  1.337635e-02    0.0097536706     0.001584467
Poverty.White10      0.007454440  7.998482e-02    0.0015844672     0.078452143
Poverty.Hispanic10  -0.002784544  2.911247e-02    0.0004963896     0.002203135
Pop.Black10         -0.005802802  6.464505e-03    0.0044911721    -0.002488616
Pop.Hispanic10      -0.003222296  1.455220e-02    0.0004154672     0.001542921
Pop.Unemp10          0.003658507  1.718152e-02   -0.0003105160     0.013712156
Pop.Manufact10       0.013104439 -1.132157e-02   -0.0016597057    -0.002158964
Pop.SelfEmp10        0.001973843 -2.174543e-02   -0.0036305812    -0.009981558
Pop.Prof10          -0.046913537 -1.234621e-01   -0.0108266716    -0.078709389
Female.LaborForce10  0.001769047 -1.584985e-02   -0.0034990851    -0.014089938
                    Poverty.Hispanic10   Pop.Black10 Pop.Hispanic10
Foreign.Born10            0.0222438589  0.0174785255   0.0211977658
Recent.Immigrant10        0.0132384740  0.0061938920   0.0107137729
Poor.English10            0.0199779710  0.0096669850   0.0147741284
Veteran10                -0.0027845436 -0.0058028015  -0.0032222963
Poverty10                 0.0291124711  0.0064645054   0.0145521973
Poverty.Black10           0.0004963896  0.0044911721   0.0004154672
Poverty.White10           0.0022031353 -0.0024886160   0.0015429211
Poverty.Hispanic10        0.0230293908  0.0026658985   0.0104442008
Pop.Black10               0.0026658985  0.0090736544   0.0027852306
Pop.Hispanic10            0.0104442008  0.0027852306   0.0117241481
Pop.Unemp10               0.0026622296 -0.0006772401   0.0023866338
Pop.Manufact10           -0.0017275338 -0.0038475682  -0.0024878315
Pop.SelfEmp10            -0.0058032887 -0.0051306155  -0.0078068065
Pop.Prof10               -0.0313756085 -0.0107094675  -0.0178821131
Female.LaborForce10       0.0012184108 -0.0027331721   0.0015334663
                      Pop.Unemp10 Pop.Manufact10 Pop.SelfEmp10  Pop.Prof10
Foreign.Born10      -0.0127724859   -0.021456576 -0.0001261392  0.17587406
Recent.Immigrant10  -0.0010572029   -0.017666776 -0.0099055937  0.05819146
Poor.English10       0.0056852412   -0.005803094 -0.0051403397 -0.01706566
Veteran10            0.0036585074    0.013104439  0.0019738427 -0.04691354
Poverty10            0.0171815177   -0.011321568 -0.0217454301 -0.12346210
Poverty.Black10     -0.0003105160   -0.001659706 -0.0036305812 -0.01082667
Poverty.White10      0.0137121560   -0.002158964 -0.0099815582 -0.07870939
Poverty.Hispanic10   0.0026622296   -0.001727534 -0.0058032887 -0.03137561
Pop.Black10         -0.0006772401   -0.003847568 -0.0051306155 -0.01070947
Pop.Hispanic10       0.0023866338   -0.002487832 -0.0078068065 -0.01788211
Pop.Unemp10          0.0200602784    0.004938378 -0.0040370057 -0.02498992
Pop.Manufact10       0.0049383782    0.071339160  0.0044803740  0.01004990
Pop.SelfEmp10       -0.0040370057    0.004480374  0.0370043671  0.05540676
Pop.Prof10          -0.0249899163    0.010049896  0.0554067631  0.48733938
Female.LaborForce10  0.0092995675    0.032299411  0.0134211194  0.08609501
                    Female.LaborForce10
Foreign.Born10              0.021372416
Recent.Immigrant10         -0.004219398
Poor.English10              0.010272132
Veteran10                   0.001769047
Poverty10                  -0.015849850
Poverty.Black10            -0.003499085
Poverty.White10            -0.014089938
Poverty.Hispanic10          0.001218411
Pop.Black10                -0.002733172
Pop.Hispanic10              0.001533466
Pop.Unemp10                 0.009299568
Pop.Manufact10              0.032299411
Pop.SelfEmp10               0.013421119
Pop.Prof10                  0.086095007
Female.LaborForce10         0.115166920
[,,2]
                    Foreign.Born10 Recent.Immigrant10 Poor.English10
Foreign.Born10        3.295106e-02       1.349935e-02   0.0079690098
Recent.Immigrant10    1.349935e-02       8.255704e-03   0.0035532096
Poor.English10        7.969010e-03       3.553210e-03   0.0045811983
Veteran10            -4.045346e-03      -2.109585e-03  -0.0010597289
Poverty10            -2.163566e-03      -4.783978e-06   0.0018662893
Poverty.Black10       1.990170e-04      -3.027397e-05   0.0002623026
Poverty.White10      -5.925024e-03      -1.749984e-03  -0.0007565458
Poverty.Hispanic10    1.529680e-03       9.103917e-04   0.0013738576
Pop.Black10           1.201974e-03       4.259454e-04   0.0006647853
Pop.Hispanic10        1.457741e-03       7.367714e-04   0.0010159965
Pop.Unemp10          -8.783463e-04      -7.270239e-05   0.0003909662
Pop.Manufact10       -1.475539e-03      -1.214920e-03  -0.0003990708
Pop.SelfEmp10        -8.674417e-06      -6.811941e-04  -0.0003534941
Pop.Prof10            1.209462e-02       4.001747e-03  -0.0011735818
Female.LaborForce10   1.469752e-03      -2.901622e-04   0.0007064004
                        Veteran10     Poverty10 Poverty.Black10 Poverty.White10
Foreign.Born10      -0.0040453458 -2.163566e-03    1.990170e-04   -0.0059250241
Recent.Immigrant10  -0.0021095854 -4.783978e-06   -3.027397e-05   -0.0017499839
Poor.English10      -0.0010597289  1.866289e-03    2.623026e-04   -0.0007565458
Veteran10            0.0034100000 -2.367360e-04   -1.659190e-04    0.0005126316
Poverty10           -0.0002367360  9.650294e-03    9.198729e-04    0.0055004465
Poverty.Black10     -0.0001659190  9.198729e-04    6.707465e-04    0.0001089616
Poverty.White10      0.0005126316  5.500446e-03    1.089616e-04    0.0053950462
Poverty.Hispanic10  -0.0001914892  2.002025e-03    3.413603e-05    0.0001515066
Pop.Black10         -0.0003990507  4.445552e-04    3.088517e-04   -0.0001711387
Pop.Hispanic10      -0.0002215929  1.000735e-03    2.857111e-05    0.0001061046
Pop.Unemp10          0.0002515905  1.181549e-03   -2.135376e-05    0.0009429661
Pop.Manufact10       0.0009011742 -7.785687e-04   -1.141357e-04   -0.0001484690
Pop.SelfEmp10        0.0001357385 -1.495403e-03   -2.496701e-04   -0.0006864181
Pop.Prof10          -0.0032261795 -8.490319e-03   -7.445353e-04   -0.0054127366
Female.LaborForce10  0.0001216550 -1.089972e-03   -2.406273e-04   -0.0009689457
                    Poverty.Hispanic10   Pop.Black10 Pop.Hispanic10
Foreign.Born10            1.529680e-03  1.201974e-03   1.457741e-03
Recent.Immigrant10        9.103917e-04  4.259454e-04   7.367714e-04
Poor.English10            1.373858e-03  6.647853e-04   1.015997e-03
Veteran10                -1.914892e-04 -3.990507e-04  -2.215929e-04
Poverty10                 2.002025e-03  4.445552e-04   1.000735e-03
Poverty.Black10           3.413603e-05  3.088517e-04   2.857111e-05
Poverty.White10           1.515066e-04 -1.711387e-04   1.061046e-04
Poverty.Hispanic10        1.583700e-03  1.833302e-04   7.182333e-04
Pop.Black10               1.833302e-04  6.239828e-04   1.915365e-04
Pop.Hispanic10            7.182333e-04  1.915365e-04   8.062536e-04
Pop.Unemp10               1.830779e-04 -4.657287e-05   1.641255e-04
Pop.Manufact10           -1.188001e-04 -2.645920e-04  -1.710848e-04
Pop.SelfEmp10            -3.990842e-04 -3.528254e-04  -5.368634e-04
Pop.Prof10               -2.157658e-03 -7.364754e-04  -1.229728e-03
Female.LaborForce10       8.378844e-05 -1.879565e-04   1.054544e-04
                      Pop.Unemp10 Pop.Manufact10 Pop.SelfEmp10    Pop.Prof10
Foreign.Born10      -8.783463e-04  -0.0014755393 -8.674417e-06  0.0120946175
Recent.Immigrant10  -7.270239e-05  -0.0012149199 -6.811941e-04  0.0040017468
Poor.English10       3.909662e-04  -0.0003990708 -3.534941e-04 -0.0011735818
Veteran10            2.515905e-04   0.0009011742  1.357385e-04 -0.0032261795
Poverty10            1.181549e-03  -0.0007785687 -1.495403e-03 -0.0084903187
Poverty.Black10     -2.135376e-05  -0.0001141357 -2.496701e-04 -0.0007445353
Poverty.White10      9.429661e-04  -0.0001484690 -6.864181e-04 -0.0054127366
Poverty.Hispanic10   1.830779e-04  -0.0001188001 -3.990842e-04 -0.0021576575
Pop.Black10         -4.657287e-05  -0.0002645920 -3.528254e-04 -0.0007364754
Pop.Hispanic10       1.641255e-04  -0.0001710848 -5.368634e-04 -0.0012297284
Pop.Unemp10          1.379518e-03   0.0003396055 -2.776193e-04 -0.0017185222
Pop.Manufact10       3.396055e-04   0.0049058961  3.081092e-04  0.0006911176
Pop.SelfEmp10       -2.776193e-04   0.0003081092  2.544740e-03  0.0038102470
Pop.Prof10          -1.718522e-03   0.0006911176  3.810247e-03  0.0335136601
Female.LaborForce10  6.395185e-04   0.0022211861  9.229520e-04  0.0059206354
                    Female.LaborForce10
Foreign.Born10             1.469752e-03
Recent.Immigrant10        -2.901622e-04
Poor.English10             7.064004e-04
Veteran10                  1.216550e-04
Poverty10                 -1.089972e-03
Poverty.Black10           -2.406273e-04
Poverty.White10           -9.689457e-04
Poverty.Hispanic10         8.378844e-05
Pop.Black10               -1.879565e-04
Pop.Hispanic10             1.054544e-04
Pop.Unemp10                6.395185e-04
Pop.Manufact10             2.221186e-03
Pop.SelfEmp10              9.229520e-04
Pop.Prof10                 5.920635e-03
Female.LaborForce10        7.919871e-03
[,,3]
                    Foreign.Born10 Recent.Immigrant10 Poor.English10
Foreign.Born10        2.084946e-02       8.541581e-03   0.0050423121
Recent.Immigrant10    8.541581e-03       5.223715e-03   0.0022482582
Poor.English10        5.042312e-03       2.248258e-03   0.0028987079
Veteran10            -2.559653e-03      -1.334819e-03  -0.0006705330
Poverty10            -1.368975e-03      -3.027015e-06   0.0011808761
Poverty.Black10       1.259260e-04      -1.915555e-05   0.0001659694
Poverty.White10      -3.749000e-03      -1.107285e-03  -0.0004786968
Poverty.Hispanic10    9.678896e-04       5.760413e-04   0.0008692948
Pop.Black10           7.605373e-04       2.695128e-04   0.0004206363
Pop.Hispanic10        9.223713e-04       4.661848e-04   0.0006428617
Pop.Unemp10          -5.557649e-04      -4.600172e-05   0.0002473800
Pop.Manufact10       -9.336329e-04      -7.687285e-04  -0.0002525081
Pop.SelfEmp10        -5.488651e-06      -4.310188e-04  -0.0002236699
Pop.Prof10            7.652749e-03       2.532066e-03  -0.0007425722
Female.LaborForce10   9.299708e-04      -1.835973e-04   0.0004469679
                        Veteran10     Poverty10 Poverty.Black10 Poverty.White10
Foreign.Born10      -2.559653e-03 -1.368975e-03    1.259260e-04   -3.749000e-03
Recent.Immigrant10  -1.334819e-03 -3.027015e-06   -1.915555e-05   -1.107285e-03
Poor.English10      -6.705330e-04  1.180876e-03    1.659694e-04   -4.786968e-04
Veteran10            2.157644e-03 -1.497924e-04   -1.049836e-04    3.243625e-04
Poverty10           -1.497924e-04  6.106128e-03    5.820405e-04    3.480353e-03
Poverty.Black10     -1.049836e-04  5.820405e-04    4.244082e-04    6.894439e-05
Poverty.White10      3.243625e-04  3.480353e-03    6.894439e-05    3.413662e-03
Poverty.Hispanic10  -1.211629e-04  1.266761e-03    2.159924e-05    9.586430e-05
Pop.Black10         -2.524954e-04  2.812879e-04    1.954229e-04   -1.082863e-04
Pop.Hispanic10      -1.402107e-04  6.332049e-04    1.807809e-05    6.713661e-05
Pop.Unemp10          1.591914e-04  7.476137e-04   -1.351138e-05    5.966525e-04
Pop.Manufact10       5.702091e-04 -4.926316e-04   -7.221822e-05   -9.394230e-05
Pop.SelfEmp10        8.588716e-05 -9.462017e-04   -1.579763e-04   -4.343242e-04
Pop.Prof10          -2.041333e-03 -5.372165e-03   -4.710974e-04   -3.424855e-03
Female.LaborForce10  7.697597e-05 -6.896692e-04   -1.522545e-04   -6.130908e-04
                    Poverty.Hispanic10   Pop.Black10 Pop.Hispanic10
Foreign.Born10            9.678896e-04  7.605373e-04   9.223713e-04
Recent.Immigrant10        5.760413e-04  2.695128e-04   4.661848e-04
Poor.English10            8.692948e-04  4.206363e-04   6.428617e-04
Veteran10                -1.211629e-04 -2.524954e-04  -1.402107e-04
Poverty10                 1.266761e-03  2.812879e-04   6.332049e-04
Poverty.Black10           2.159924e-05  1.954229e-04   1.807809e-05
Poverty.White10           9.586430e-05 -1.082863e-04   6.713661e-05
Poverty.Hispanic10        1.002070e-03  1.160004e-04   4.544550e-04
Pop.Black10               1.160004e-04  3.948189e-04   1.211928e-04
Pop.Hispanic10            4.544550e-04  1.211928e-04   5.101490e-04
Pop.Unemp10               1.158407e-04 -2.946853e-05   1.038488e-04
Pop.Manufact10           -7.516960e-05 -1.674180e-04  -1.082522e-04
Pop.SelfEmp10            -2.525166e-04 -2.232468e-04  -3.396950e-04
Pop.Prof10               -1.365236e-03 -4.659975e-04  -7.780984e-04
Female.LaborForce10       5.301630e-05 -1.189276e-04   6.672521e-05
                      Pop.Unemp10 Pop.Manufact10 Pop.SelfEmp10    Pop.Prof10
Foreign.Born10      -5.557649e-04  -9.336329e-04 -5.488651e-06  0.0076527494
Recent.Immigrant10  -4.600172e-05  -7.687285e-04 -4.310188e-04  0.0025320656
Poor.English10       2.473800e-04  -2.525081e-04 -2.236699e-04 -0.0007425722
Veteran10            1.591914e-04   5.702091e-04  8.588716e-05 -0.0020413331
Poverty10            7.476137e-04  -4.926316e-04 -9.462017e-04 -0.0053721651
Poverty.Black10     -1.351138e-05  -7.221822e-05 -1.579763e-04 -0.0004710974
Poverty.White10      5.966525e-04  -9.394230e-05 -4.343242e-04 -0.0034248555
Poverty.Hispanic10   1.158407e-04  -7.516960e-05 -2.525166e-04 -0.0013652364
Pop.Black10         -2.946853e-05  -1.674180e-04 -2.232468e-04 -0.0004659975
Pop.Hispanic10       1.038488e-04  -1.082522e-04 -3.396950e-04 -0.0007780984
Pop.Unemp10          8.728762e-04   2.148820e-04 -1.756609e-04 -0.0010873779
Pop.Manufact10       2.148820e-04   3.104157e-03  1.949530e-04  0.0004372978
Pop.SelfEmp10       -1.756609e-04   1.949530e-04  1.610159e-03  0.0024108961
Pop.Prof10          -1.087378e-03   4.372978e-04  2.410896e-03  0.0212054366
Female.LaborForce10  4.046490e-04   1.405434e-03  5.839887e-04  0.0037462234
                    Female.LaborForce10
Foreign.Born10             9.299708e-04
Recent.Immigrant10        -1.835973e-04
Poor.English10             4.469679e-04
Veteran10                  7.697597e-05
Poverty10                 -6.896692e-04
Poverty.Black10           -1.522545e-04
Poverty.White10           -6.130908e-04
Poverty.Hispanic10         5.301630e-05
Pop.Black10               -1.189276e-04
Pop.Hispanic10             6.672521e-05
Pop.Unemp10                4.046490e-04
Pop.Manufact10             1.405434e-03
Pop.SelfEmp10              5.839887e-04
Pop.Prof10                 3.746223e-03
Female.LaborForce10        5.011220e-03
[,,4]
                    Foreign.Born10 Recent.Immigrant10 Poor.English10
Foreign.Born10        8.657590e-02       3.546831e-02   0.0209378452
Recent.Immigrant10    3.546831e-02       2.169111e-02   0.0093357336
Poor.English10        2.093785e-02       9.335734e-03   0.0120366800
Veteran10            -1.062878e-02      -5.542743e-03  -0.0027843408
Poverty10            -5.684572e-03      -1.256947e-05   0.0049035047
Poverty.Black10       5.228989e-04      -7.954208e-05   0.0006891762
Poverty.White10      -1.556746e-02      -4.597923e-03  -0.0019877549
Poverty.Hispanic10    4.019093e-03       2.391971e-03   0.0036096854
Pop.Black10           3.158077e-03       1.119133e-03   0.0017466626
Pop.Hispanic10        3.830082e-03       1.935800e-03   0.0026694380
Pop.Unemp10          -2.307775e-03      -1.910189e-04   0.0010272281
Pop.Manufact10       -3.876845e-03      -3.192091e-03  -0.0010485221
Pop.SelfEmp10        -2.279124e-05      -1.789775e-03  -0.0009287735
Pop.Prof10            3.177750e-02       1.051422e-02  -0.0030834789
Female.LaborForce10   3.861638e-03      -7.623748e-04   0.0018560025
                        Veteran10     Poverty10 Poverty.Black10 Poverty.White10
Foreign.Born10      -0.0106287766 -5.684572e-03    5.228989e-04   -0.0155674595
Recent.Immigrant10  -0.0055427430 -1.256947e-05   -7.954208e-05   -0.0045979228
Poor.English10      -0.0027843408  4.903505e-03    6.891762e-04   -0.0019877549
Veteran10            0.0089594635 -6.220023e-04   -4.359370e-04    0.0013468926
Poverty10           -0.0006220023  2.535527e-02    2.416882e-03    0.0144519205
Poverty.Black10     -0.0004359370  2.416882e-03    1.762325e-03    0.0002862867
Poverty.White10      0.0013468926  1.445192e-02    2.862867e-04    0.0141749908
Poverty.Hispanic10  -0.0005031205  5.260137e-03    8.968931e-05    0.0003980697
Pop.Black10         -0.0010484692  1.168028e-03    8.114797e-04   -0.0004496513
Pop.Hispanic10      -0.0005822151  2.629339e-03    7.506798e-05    0.0002787801
Pop.Unemp10          0.0006610311  3.104413e-03   -5.610505e-05    0.0024775574
Pop.Manufact10       0.0023677530 -2.045618e-03   -2.998811e-04   -0.0003900888
Pop.SelfEmp10        0.0003566404 -3.929036e-03   -6.559853e-04   -0.0018035007
Pop.Prof10          -0.0084764919 -2.230754e-02   -1.956199e-03   -0.0142214707
Female.LaborForce10  0.0003196373 -2.863803e-03   -6.322262e-04   -0.0025458163
                    Poverty.Hispanic10   Pop.Black10 Pop.Hispanic10
Foreign.Born10            4.019093e-03  0.0031580774   3.830082e-03
Recent.Immigrant10        2.391971e-03  0.0011191327   1.935800e-03
Poor.English10            3.609685e-03  0.0017466626   2.669438e-03
Veteran10                -5.031205e-04 -0.0010484692  -5.822151e-04
Poverty10                 5.260137e-03  0.0011680281   2.629339e-03
Poverty.Black10           8.968931e-05  0.0008114797   7.506798e-05
Poverty.White10           3.980697e-04 -0.0004496513   2.787801e-04
Poverty.Hispanic10        4.161026e-03  0.0004816833   1.887092e-03
Pop.Black10               4.816833e-04  0.0016394577   5.032446e-04
Pop.Hispanic10            1.887092e-03  0.0005032446   2.118358e-03
Pop.Unemp10               4.810204e-04 -0.0001223660   4.312248e-04
Pop.Manufact10           -3.121365e-04 -0.0006951912  -4.495096e-04
Pop.SelfEmp10            -1.048557e-03 -0.0009270165  -1.410559e-03
Pop.Prof10               -5.669048e-03 -0.0019350218  -3.230999e-03
Female.LaborForce10       2.201465e-04 -0.0004938385   2.770717e-04
                      Pop.Unemp10 Pop.Manufact10 Pop.SelfEmp10   Pop.Prof10
Foreign.Born10      -2.307775e-03  -0.0038768446 -2.279124e-05  0.031777502
Recent.Immigrant10  -1.910189e-04  -0.0031920911 -1.789775e-03  0.010514224
Poor.English10       1.027228e-03  -0.0010485221 -9.287735e-04 -0.003083479
Veteran10            6.610311e-04   0.0023677530  3.566404e-04 -0.008476492
Poverty10            3.104413e-03  -0.0020456181 -3.929036e-03 -0.022307537
Poverty.Black10     -5.610505e-05  -0.0002998811 -6.559853e-04 -0.001956199
Poverty.White10      2.477557e-03  -0.0003900888 -1.803501e-03 -0.014221471
Poverty.Hispanic10   4.810204e-04  -0.0003121365 -1.048557e-03 -0.005669048
Pop.Black10         -1.223660e-04  -0.0006951912 -9.270165e-04 -0.001935022
Pop.Hispanic10       4.312248e-04  -0.0004495096 -1.410559e-03 -0.003230999
Pop.Unemp10          3.624557e-03   0.0008922824 -7.294194e-04 -0.004515260
Pop.Manufact10       8.922824e-04   0.0128897937  8.095287e-04  0.001815848
Pop.SelfEmp10       -7.294194e-04   0.0008095287  6.686071e-03  0.010011076
Pop.Prof10          -4.515260e-03   0.0018158482  1.001108e-02  0.088054080
Female.LaborForce10  1.680276e-03   0.0058359636  2.424972e-03  0.015555929
                    Female.LaborForce10
Foreign.Born10             0.0038616383
Recent.Immigrant10        -0.0007623748
Poor.English10             0.0018560025
Veteran10                  0.0003196373
Poverty10                 -0.0028638029
Poverty.Black10           -0.0006322262
Poverty.White10           -0.0025458163
Poverty.Hispanic10         0.0002201465
Pop.Black10               -0.0004938385
Pop.Hispanic10             0.0002770717
Pop.Unemp10                0.0016802764
Pop.Manufact10             0.0058359636
Pop.SelfEmp10              0.0024249719
Pop.Prof10                 0.0155559286
Female.LaborForce10        0.0208087371
[,,5]
                    Foreign.Born10 Recent.Immigrant10 Poor.English10
Foreign.Born10        1.517012e-02       6.214878e-03   0.0036687998
Recent.Immigrant10    6.214878e-03       3.800789e-03   0.0016358387
Poor.English10        3.668800e-03       1.635839e-03   0.0021091077
Veteran10            -1.862410e-03      -9.712181e-04  -0.0004878816
Poverty10            -9.960699e-04      -2.202464e-06   0.0008592086
Poverty.Black10       9.162410e-05      -1.393763e-05   0.0001207598
Poverty.White10      -2.727783e-03      -8.056635e-04  -0.0003483011
Poverty.Hispanic10    7.042391e-04       4.191292e-04   0.0006325012
Pop.Black10           5.533690e-04       1.960982e-04   0.0003060561
Pop.Hispanic10        6.711199e-04       3.391973e-04   0.0004677479
Pop.Unemp10          -4.043761e-04      -3.347098e-05   0.0001799944
Pop.Manufact10       -6.793138e-04      -5.593290e-04  -0.0001837256
Pop.SelfEmp10        -3.993558e-06      -3.136104e-04  -0.0001627428
Pop.Prof10            5.568161e-03       1.842338e-03  -0.0005402976
Female.LaborForce10   6.766493e-04      -1.335859e-04   0.0003252150
                        Veteran10     Poverty10 Poverty.Black10 Poverty.White10
Foreign.Born10      -1.862410e-03 -9.960699e-04    9.162410e-05   -2.727783e-03
Recent.Immigrant10  -9.712181e-04 -2.202464e-06   -1.393763e-05   -8.056635e-04
Poor.English10      -4.878816e-04  8.592086e-04    1.207598e-04   -3.483011e-04
Veteran10            1.569907e-03 -1.089893e-04   -7.638635e-05    2.360071e-04
Poverty10           -1.089893e-04  4.442835e-03    4.234942e-04    2.532314e-03
Poverty.Black10     -7.638635e-05  4.234942e-04    3.088006e-04    5.016413e-05
Poverty.White10      2.360071e-04  2.532314e-03    5.016413e-05    2.483790e-03
Poverty.Hispanic10  -8.815847e-05  9.216989e-04    1.571566e-05    6.975112e-05
Pop.Black10         -1.837163e-04  2.046658e-04    1.421902e-04   -7.878942e-05
Pop.Hispanic10      -1.020177e-04  4.607216e-04    1.315366e-05    4.884878e-05
Pop.Unemp10          1.158281e-04  5.439657e-04   -9.830916e-06    4.341260e-04
Pop.Manufact10       4.148857e-04 -3.584401e-04   -5.254617e-05   -6.835267e-05
Pop.SelfEmp10        6.249173e-05 -6.884589e-04   -1.149440e-04   -3.160155e-04
Pop.Prof10          -1.485279e-03 -3.908802e-03   -3.427717e-04   -2.491934e-03
Female.LaborForce10  5.600792e-05 -5.018052e-04   -1.107808e-04   -4.460865e-04
                    Poverty.Hispanic10   Pop.Black10 Pop.Hispanic10
Foreign.Born10            7.042391e-04  5.533690e-04   6.711199e-04
Recent.Immigrant10        4.191292e-04  1.960982e-04   3.391973e-04
Poor.English10            6.325012e-04  3.060561e-04   4.677479e-04
Veteran10                -8.815847e-05 -1.837163e-04  -1.020177e-04
Poverty10                 9.216989e-04  2.046658e-04   4.607216e-04
Poverty.Black10           1.571566e-05  1.421902e-04   1.315366e-05
Poverty.White10           6.975112e-05 -7.878942e-05   4.884878e-05
Poverty.Hispanic10        7.291090e-04  8.440217e-05   3.306627e-04
Pop.Black10               8.440217e-05  2.872713e-04   8.818022e-05
Pop.Hispanic10            3.306627e-04  8.818022e-05   3.711858e-04
Pop.Unemp10               8.428601e-05 -2.144138e-05   7.556067e-05
Pop.Manufact10           -5.469361e-05 -1.218138e-04  -7.876458e-05
Pop.SelfEmp10            -1.837317e-04 -1.624349e-04  -2.471630e-04
Pop.Prof10               -9.933497e-04 -3.390610e-04  -5.661465e-04
Female.LaborForce10       3.857481e-05 -8.653205e-05   4.854944e-05
                      Pop.Unemp10 Pop.Manufact10 Pop.SelfEmp10    Pop.Prof10
Foreign.Born10      -4.043761e-04  -6.793138e-04 -3.993558e-06  0.0055681611
Recent.Immigrant10  -3.347098e-05  -5.593290e-04 -3.136104e-04  0.0018423378
Poor.English10       1.799944e-04  -1.837256e-04 -1.627428e-04 -0.0005402976
Veteran10            1.158281e-04   4.148857e-04  6.249173e-05 -0.0014852795
Poverty10            5.439657e-04  -3.584401e-04 -6.884589e-04 -0.0039088018
Poverty.Black10     -9.830916e-06  -5.254617e-05 -1.149440e-04 -0.0003427717
Poverty.White10      4.341260e-04  -6.835267e-05 -3.160155e-04 -0.0024919341
Poverty.Hispanic10   8.428601e-05  -5.469361e-05 -1.837317e-04 -0.0009933497
Pop.Black10         -2.144138e-05  -1.218138e-04 -1.624349e-04 -0.0003390610
Pop.Hispanic10       7.556067e-05  -7.876458e-05 -2.471630e-04 -0.0005661465
Pop.Unemp10          6.351071e-04   1.563487e-04 -1.278113e-04 -0.0007911791
Pop.Manufact10       1.563487e-04   2.258593e-03  1.418483e-04  0.0003181790
Pop.SelfEmp10       -1.278113e-04   1.418483e-04  1.171556e-03  0.0017541745
Pop.Prof10          -7.911791e-04   3.181790e-04  1.754174e-03  0.0154291327
Female.LaborForce10  2.944237e-04   1.022597e-03  4.249118e-04  0.0027257623
                    Female.LaborForce10
Foreign.Born10             6.766493e-04
Recent.Immigrant10        -1.335859e-04
Poor.English10             3.252150e-04
Veteran10                  5.600792e-05
Poverty10                 -5.018052e-04
Poverty.Black10           -1.107808e-04
Poverty.White10           -4.460865e-04
Poverty.Hispanic10         3.857481e-05
Pop.Black10               -8.653205e-05
Pop.Hispanic10             4.854944e-05
Pop.Unemp10                2.944237e-04
Pop.Manufact10             1.022597e-03
Pop.SelfEmp10              4.249118e-04
Pop.Prof10                 2.725762e-03
Female.LaborForce10        3.646177e-03

An algorithm was used to cluster tracts into five distinct groups. The probabilities of each group is not evenly spread as you can see. Group two has a probablitiy of 41.3% while groups 1 and 3 only have a 7& and 6% respectively. Also listed are the statistics for each variable within the groups. Also, there are tabs for each group for easier view and description of that group.

Cluster 1


Label: Female Labor Force, Low-Income, Recent Immigrant, Minorities

This group focuses on female labor force, people of all racial backgrounds in poverty, and a high foreign born with low English skills.

Cluster 2


Label: Female Labor Force, Professional, Foreign-Born and White

This group focuses high on female labor force, professional jobs, and foreign born. Like Group 1, this group has high female labor and foreign born, but unlike group 1, it has low poor English, low poverty, and high professional jobs.

Cluster 3


Label: Female Labor Force, Professional, Self-Employeed, White

This group is similar to Group 2, but with less foreign born people and higher self employeed people. It has a low Black and Hispanic population.

Cluster 4


Label: Female Labor Force, Professional and Low-Income, Minorities, Foreign Born

This group has a mixed bag. It has high professional and poverty. It has semi-decent self employed and manufacturing. It has high minorities and foreign born and since the poverty white is high, there is most likely many white people in this group as well.

Cluster 5


Label: Female Labor Force, Professional, White, Wealthy

This group shows where the wealthier, professional people live. Still a high female labor force, this one has low minorities and foreign born. There is also low poverty and unemployment.

Neighborhoods

Mapping Clusters


Here you can see where the five different clusters reside on a map of Seattle.

Neighborhood Change

Creating Transition Matrix

   
             1          2          3          4          5
  1 0.87500000 0.00000000 0.00000000 0.12500000 0.00000000
  2 0.00000000 0.64912281 0.04385965 0.22807018 0.07894737
  3 0.00000000 0.00000000 0.62500000 0.00000000 0.37500000
  4 0.16666667 0.14285714 0.00000000 0.66666667 0.02380952
  5 0.00000000 0.05555556 0.05555556 0.00000000 0.88888889

We can see that most counties remain in the same clustering over the two time periods. This is not super surprising due to the relatively short time frame 2000-2010.

Neighborhood Transitions


In this Sankey diagram we can see the pattern of clusters transitioning to other clusters from 2000 to 2010. Clusters 1, 2, 4, and 5 all tend to stay in the same cluster when advancing 10 years. Cluster 3 tends to split into clusters 3 and 5. A little bit of gentrification is showing where some of clusters 2 and 3 advance to cluster 5.

About

About the Developer


Jason Eastman resides in Gilbert, Arizona with his wife and four daughters. He has a Bachelor of Science in Computational Mathematics and is currently attending Arizona State University acquiring a Master’s in Program Evaluation and Data Analytics. His hobbies include role playing games, movies, and spending time with his family.

email: jason.eastman@live.com

Documentation


A US census API key was used in order to download the census information. One must acquire this online in order to download the census information themselves. All packages used can be found on CRAN. Packages used:

  • tidycensus: is an R package that allows users to interface with the US Census Bureau’s decennial Census and five-year American Community APIs and return tidyverse-ready data frames, optionally with simple feature geometry included.
  • tidyverse: is an opinionated collection of R packages designed for data science.
  • dplyr: is a grammar of data manipulation, providing a consistent set of verbs that help you solve the most common data manipulation challenges.
  • stargazer: Produces LaTeX code, HTML/CSS code and ASCII text for well-formatted tables that hold regression analysis results from several models side-by-side, as well as summary statistics
  • corrplot: A graphical display of a correlation matrix or general matrix. It also contains some algorithms to do matrix reordering. In addition, corrplot is good at details, including choosing color, text labels, color labels, layout, etc.
  • purrr: A complete and consistent functional programming toolkit for R.
  • flexdashboard: Format for converting an R Markdown document to a grid oriented dashboard. The dashboard flexibly adapts the size of it’s components to the containing web page.
  • leaflet: Create and customize interactive maps using the ‘Leaflet’ JavaScript library and the ‘htmlwidgets’ package.
  • DT: Data objects in R can be rendered as HTML tables using the JavaScript library ‘DataTables’.
  • geojsonio: Convert data to ‘GeoJSON’ or ‘TopoJSON’ from various R classes, including vectors, lists, data frames, shape files, and spatial classes.
  • sp: Classes and methods for spatial data; the classes document where the spatial location information resides, for 2D or 3D data.
  • sf: Support for simple features, a standardized way to encode spatial vector data. Binds to ‘GDAL’ for reading and writing data, to ‘GEOS’ for geometrical operations, and to ‘PROJ’ for projection conversions and datum transformations.
  • mclust: Gaussian finite mixture models fitted via EM algorithm for model-based clustering, classification, and density estimation, including Bayesian regularization, dimension reduction for visualisation, and resampling-based inference.
  • tmap: Thematic maps are geographical maps in which spatial data distributions are visualized.
  • ggplot2: A system for ‘declaratively’ creating graphics, based on “The Grammar of Graphics”.
  • ggthemes: Some extra themes, geoms, and scales for ‘ggplot2’.
  • plyr: A set of tools that solves a common set of problems.
  • pander: Contains some functions catching all messages, ‘stdout’ and other useful information while evaluating R code and other helpers to return user specified text elements in ‘pandoc’ markdown or several type of R objects similarly automatically. transformed to markdown format.
  • cartogram: Construct continuous and non-contiguous area cartograms.
  • maptools: Set of tools for manipulating geographic data. It includes binary access to ‘GSHHG’ shoreline files.
---
title: "Community Analytics Practicum Extravaganza"
author: "Jason Eastman"
output: 
  flexdashboard::flex_dashboard:
    social: menu
    source: embed
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(  message=F, warning=F, echo=F )

#Load in libraries
library( tidycensus )
library( tidyverse )
library( dplyr )
library( stargazer )
library( corrplot )
library( purrr )
library( flexdashboard )
library( leaflet )
library( DT )
library( geojsonio )   # read shapefiles
library( sp )          # work with shapefiles
library( sf )          # work with shapefiles - simple features format
library( mclust )      # cluster analysis 
library( tmap )        # theme maps
library( ggplot2 )     # graphing 
library( ggthemes )    # nice formats for ggplots
library( plyr )        
library( pander )      # formatting RMD tables
library( cartogram )   # spatial maps w/ tract size bias reduction
library( maptools )    # spatial object manipulation 
```

```{r, quietly=T, include=F}
census_key <- "202e15efbfcd87b6195f39915e5684b2fcefd7a6"
census_api_key(census_key)
options(tigris_use_cache = TRUE)

#Loading data 
URL <- "https://github.com/DS4PS/cpp-529-master/raw/master/data/CensusData.rds"
census.dats <- readRDS(gzcon(url( URL )))
census.dats <- na.omit(census.dats)
```






Introduction {.storyboard}
=========================================



### Project Overview

```{r}
leaflet() %>%
  addTiles() %>%
  addMarkers(lng=-122.335, lat=47.608, popup="Seattle, WA")
```


***

Introduction to neighborhood change in Seattle, Washington

I chose Seattle as my city topic. With tech industries booming in Seattle, it would be fun to look at the growth and gentrification that has recently accured in the city. The main tasks you will see are:

- A quick view of the data, including a 5-point summary, histogram, and correlation plot.
- A regression analysis based on some of the more correlated variables.
- A clustering analysis showing five major groups of neighborhoods, their descriptions, and their locations.
- Neighborhood transitions and what the trends tend to be within neighborhood growth.




Data {.storyboard}
=========================================


### Empirical Framework 

```{r, echo=F}
# creating a subset of the data to only include the Seattle area
counties <- c("King County", "Island County", "Snohomish County")
census.dats <- census.dats[ which(census.dats$county == counties),]
```


```{r, echo=F}
#Calculating change Values for variables 

censusChange1<-ddply(census.dats,"TRTID10",summarise, 
       HousePriceChange = log(Median.HH.Value10)/log((Median.HH.Value00)) - 1,
       FreignBornChange = Foreign.Born10/(Foreign.Born00 +.01) - 1,
       RecentImmigrantChange = Recent.Immigrant10/(Recent.Immigrant00+.01) - 1,
       PoorEnglishChange = Poor.English10/(Poor.English00+.01) - 1,
       VeteranChange = Veteran10/(Veteran00+.01) - 1,
       PovertyChange = Poverty10/(Poverty00+.01) - 1,
       PovertyBlackChange = Poverty.Black10/(Poverty.Black00+.01) - 1,
       PovertyWhiteChange = Poverty.White10/(Poverty.White00+.01) - 1,
       PovertyHispanicChange = Poverty.Hispanic10/(Poverty.Hispanic00+.01) - 1,
       PopBlackChange = Pop.Black10/(Pop.Black00+.01) - 1,
       PopHispanicChange = Pop.Hispanic10/(Pop.Hispanic00+.01) - 1,
       PopUnempChange = Pop.Unemp10/(Pop.Unemp00+.01) - 1,
       PopManufactChange = Pop.Manufact10/(Pop.Manufact00+.01) - 1,
       PopSelfEmpChange = Pop.SelfEmp10/(Pop.SelfEmp00+.01) - 1,
       PopProfChange = Pop.Prof10/(Pop.Prof00+.01) - 1,
       FemaleLaborForceChange = Female.LaborForce10/(Female.LaborForce00+.01) - 1
)

#remove NAs that result 
censusChange1<-censusChange1[!duplicated(censusChange1$TRTID10),]
```

```{r}
summary(censusChange1)
```

***

This data came from the US census and is of the year 2010 and 2000. This unit of analysis was population. The variables looked at are:

- Foreign.Born
- Recent.Immigrant
- Poor.English
- Veteran
- Poverty
- Poverty.Black
- Poverty.White
- Poverty.Hispanic
- Pop.Black
- Pop.Hispanic
- Pop.Unemp
- Pop.Manufact
- Pop.SelfEmp
- Pop.Prof
- Female.LaborForce

These variables have been modified as well to show the change between 2000 and 2010 in each category. Some of the more promenant variables include Veteran, Poverty.White, Pop.SelfEmp, and Pop.Manufact.



### View Data 

```{r}
DT::datatable( head(censusChange1, 25) )
```


***

This data used the original data and found the percent change from 2000 to 2010 in each variable for each county tract. I took the 2010 variable, divided it by the 2000 variable and subtracted one. To look at an example, in the shown data, you can see in the first tract that House Price Change has gone up by 5.3%. You can also see taht Foreign Born decreased by 45.7%.




### 5-point summary  

```{r, results='asis',message=F, warning=F, fig.width = 9,fig.align='center', echo=F }
#Visualize 5-point summary
censusChange1 %>%
    keep(is.numeric) %>% 
stargazer(
          omit.summary.stat = c("p25", "p75"), nobs=F, type="html") # For a pdf document, replace html with latex
```


***

Here is a 5-point summary of the 10 year change within variables. For example, the average (mean) increase in House Price was 3.6% where the max was 7.4% in one tract. There are some outliers as well. Poverty Black had a max increase of 1,300% and the Povert Hispanic had a max increase of 1,583%. That would be something to look at furthur for accuracy. For some variables, there was a decrease in change. For example, Veterans decreased by an average (mean) of 33.3%.



### Histogram 

```{r,message=F, warning=F, echo=F}
#Histogram
censusChange1 %>%
  keep(is.numeric) %>% 
  gather() %>% 
  ggplot(aes(value)) +
    facet_wrap(~ key, scales = "free") +
    geom_histogram()
```


***

As you can see, the majority of these histograms follow a normal curve including some of the variables of interest such as Labor Force, Manufacturing, Professional, and Veteran. There were others thogh that did not follow a normal curve and were quite skewed such as House Price, Proverty Black, Poverty Hispanic, and Population Black.



### Correlation Plot 

```{r, message=F, warning=F, echo=F}
##save correlations in train_cor
train_cor <- cor(censusChange1[,-1])

##Correlation Plot
corrplot(train_cor, type='lower')

```


***

In this chart yo can see that some variables are collinear such as Foreign Born, Recent Immigration, and Poor English. A strong correlation, possible collinearization, shows for Poverty White and Poverty. Another positive correlation would be Population Black and Poor English. On the opposite end, House Price and Self Employeed show a negative correlation.



Regressions
=========================================


### Regression Model Results 

```{r, results='asis', fig.align='center'}

reg1<-lm(HousePriceChange ~  FreignBornChange + PovertyChange + PopBlackChange + PopUnempChange 
            , data=censusChange1)

reg2<-lm(HousePriceChange ~  FreignBornChange + RecentImmigrantChange + PoorEnglishChange  + VeteranChange + PovertyChange + PovertyBlackChange + PovertyWhiteChange + PovertyHispanicChange + PopBlackChange + PopHispanicChange  , data=censusChange1)

reg3<-lm(HousePriceChange ~  FreignBornChange + RecentImmigrantChange + PoorEnglishChange  + VeteranChange + PovertyChange + PovertyBlackChange + PovertyWhiteChange + PovertyHispanicChange + PopBlackChange + PopHispanicChange +
PopHispanicChange + PopUnempChange +  PopManufactChange +  PopSelfEmpChange + PopProfChange + FemaleLaborForceChange   , data=censusChange1)

# present results with stargazer
# library(stargazer)
stargazer( reg1, reg2, reg3, 
           title="Effect of Community Change on Housing Price Change",
           type='html', align=TRUE )

```



***

Here, we can see a regression model of the changes within 2000 to 2010. Some of the stronger variabls that stand one would be Veteran Change, Poverty White Change, Population Manufacturin Change, and Population Self Employeed Change. These were all statistically siginificant. 



Clustering {.storyboard}
=========================================



### Identifying Communities

```{r ,message=F, warning=F, echo=F, fig.align='center'}
# Cluster analysis for 2010 Data
# library(mclust)

Census2010<-census.dats
keep.these1 <-c("Foreign.Born10","Recent.Immigrant10","Poor.English10","Veteran10","Poverty10","Poverty.Black10","Poverty.White10","Poverty.Hispanic10","Pop.Black10","Pop.Hispanic10","Pop.Unemp10","Pop.Manufact10","Pop.SelfEmp10","Pop.Prof10","Female.LaborForce10")

#Run Cluster Analysis
mod2 <- Mclust(Census2010[keep.these1],G=5 ) # Set groups to 5, but you can remove this to let r split data into own groupings

summary(mod2, parameters = TRUE)

#Add group classification to df
Census2010$cluster <- mod2$classification
```


```{r ,message=F, warning=F, echo=F, fig.align='center'}

#Visualize Data
stats1 <- 
  Census2010 %>% 
  group_by( cluster ) %>% 
  select(keep.these1)%>% 
  summarise_each( funs(mean) )

t <- data.frame( t(stats1), stringsAsFactors=F )
names(t) <- paste0( "GROUP.", 1:5 )
t <- t[-1,]
```


***

An algorithm was used to cluster tracts into five distinct groups. The probabilities of each group is not evenly spread as you can see.  Group two has a probablitiy of 41.3% while groups 1 and 3 only have a 7& and 6% respectively. Also listed are the statistics for each variable within the groups. Also, there are tabs for each group for easier view and description of that group.



### Cluster 1

```{r ,message=F, warning=F, echo=F, fig.align='center'}

plot( rep(1,15), 1:15, bty="n", xlim=c(-.2,1.0), 
      type="n", xaxt="n", yaxt="n",
      xlab="Score", ylab="",
      main=paste("GROUP",1) )
abline( v=seq(0,1.0,.1), lty=3, lwd=1.5, col="gray90" )
segments( y0=1:15, x0=0, x1=100, col="gray70", lwd=2 )
text( 0, 1:15, keep.these1, cex=0.85, pos=2 )
points( t[,1], 1:15, pch=19, col="Steelblue", cex=1.5 )
axis( side=1, at=c(0,.1,.3,.2,.4,.5,.6,.7,.8,.9,1.0), col.axis="gray", col="gray" )

```


***

Label: Female Labor Force, Low-Income, Recent Immigrant, Minorities

This group focuses on female labor force, people of all racial backgrounds in poverty, and a high foreign born with low English skills.



### Cluster 2

```{r ,message=F, warning=F, echo=F, fig.align='center'}

plot( rep(1,15), 1:15, bty="n", xlim=c(-.2,.7), 
      type="n", xaxt="n", yaxt="n",
      xlab="Score", ylab="",
      main=paste("GROUP",2) )
abline( v=seq(0,.7,.1), lty=3, lwd=1.5, col="gray90" )
segments( y0=1:15, x0=0, x1=100, col="gray70", lwd=2 )
text( 0, 1:15, keep.these1, cex=0.85, pos=2 )
points( t[,2], 1:15, pch=19, col="Steelblue", cex=1.5 )
axis( side=1, at=c(0,.1,.3,.2,.4,.5,.6,.7), col.axis="gray", col="gray" )

```


***

Label: Female Labor Force, Professional, Foreign-Born and White


This group focuses high on female labor force, professional jobs, and foreign born. Like Group 1, this group has high female labor and foreign born, but unlike group 1, it has low poor English, low poverty, and high professional jobs.



### Cluster 3 

```{r ,message=F, warning=F, echo=F, fig.align='center'}

plot( rep(1,15), 1:15, bty="n", xlim=c(-.2,.7), 
      type="n", xaxt="n", yaxt="n",
      xlab="Score", ylab="",
      main=paste("GROUP",3) )
abline( v=seq(0,.7,.1), lty=3, lwd=1.5, col="gray90" )
segments( y0=1:15, x0=0, x1=100, col="gray70", lwd=2 )
text( 0, 1:15, keep.these1, cex=0.85, pos=2 )
points( t[,3], 1:15, pch=19, col="Steelblue", cex=1.5 )
axis( side=1, at=c(0,.1,.3,.2,.4,.5,.6,.7), col.axis="gray", col="gray" )

```


***

Label: Female Labor Force, Professional, Self-Employeed, White

This group is similar to Group 2, but with less foreign born people and higher self employeed people. It has a low Black and Hispanic population.


### Cluster 4 

```{r ,message=F, warning=F, echo=F, fig.align='center'}

plot( rep(1,15), 1:15, bty="n", xlim=c(-.2,.7), 
      type="n", xaxt="n", yaxt="n",
      xlab="Score", ylab="",
      main=paste("GROUP",4) )
abline( v=seq(0,.7,.1), lty=3, lwd=1.5, col="gray90" )
segments( y0=1:15, x0=0, x1=100, col="gray70", lwd=2 )
text( 0, 1:15, keep.these1, cex=0.85, pos=2 )
points( t[,4], 1:15, pch=19, col="Steelblue", cex=1.5 )
axis( side=1, at=c(0,.1,.3,.2,.4,.5,.6,.7), col.axis="gray", col="gray" )

```


***

Label: Female Labor Force, Professional and Low-Income, Minorities, Foreign Born

This group has a mixed bag. It has high professional and poverty. It has semi-decent self employed and manufacturing. It has high minorities and foreign born and since the poverty white is high, there is most likely many white people in this group as well.


### Cluster 5 

```{r ,message=F, warning=F, echo=F, fig.align='center'}

plot( rep(1,15), 1:15, bty="n", xlim=c(-.2,1.0), 
      type="n", xaxt="n", yaxt="n",
      xlab="Score", ylab="",
      main=paste("GROUP",5) )
abline( v=seq(0,1.0,.1), lty=3, lwd=1.5, col="gray90" )
segments( y0=1:15, x0=0, x1=100, col="gray70", lwd=2 )
text( 0, 1:15, keep.these1, cex=0.85, pos=2 )
points( t[,5], 1:15, pch=19, col="Steelblue", cex=1.5 )
axis( side=1, at=c(0,.1,.3,.2,.4,.5,.6,.7,.8,.9,1.0), col.axis="gray", col="gray" )

```

***

Label: Female Labor Force, Professional, White, Wealthy

This group shows where the wealthier, professional people live. Still a high female labor force, this one has low minorities and foreign born. There is also low poverty and unemployment.




Neighborhoods {.storyboard}
=========================================


### Mapping Clusters

```{r, message=F, warning=F, echo=F}
SpacialData <-
  get_acs( geography = "tract",
           variables = "B01003_001",
           state = "53",
           county = c("29","33","61"),
           geometry = TRUE ) %>%
  select( GEOID, estimate ) %>%
  dplyr::rename( POP = estimate )

seattle <- merge( SpacialData, Census2010,
                  by.x="GEOID", by.y="TRTID10" )
seattle2 <- seattle[ ! st_is_empty( seattle ) , ]
seattle.sp <- as_Spatial( seattle2 )

#plot( seattle.sp )

# project map and remove empty tracts
seattle.sp <- spTransform( seattle.sp, CRS("+init=epsg:3395"))
seattle.sp <- seattle.sp[ seattle.sp$POP != 0 & (! is.na( seattle.sp$POP )) , ]

# convert census tract polygons to dorling cartogram
# no idea why k=0.03 works, but it does - default is k=5
seattle.sp$pop.w <- seattle.sp$POP / ( max( seattle.sp$POP ) / 1.5 )
# standardizes it to max of 1.5
seattle_dorling <- cartogram_dorling( x=seattle.sp, weight="pop.w", k=0.05 )

# user-defined bounding box to move closer to subjects 
bb <- st_bbox( c( xmin =  -13648144, xmax = -13574481, 
                  ymax = 6093019, ymin = 5948351 ), 
               crs = st_crs("+init=epsg:3395"))

tmap_mode("plot")
tmap_style("cobalt")

tm_basemap( leaflet::providers$Stamen.Watercolor ) +
  tm_shape( seattle_dorling, bbox=bb ) + 
  tm_polygons( col="cluster", n=5, palette = "Accent" ) +
  tm_legend( position = c("left", "top") ) + 
  tm_layout( "Dorling Cartogram", title.position=c("right","bottom") )

```


```{r ,message=F, warning=F, echo=F, fig.align='center'}
#Predicting cluster Grouping for 2000 census tracts

# Get 2000 data
Census2000 <-census.dats


keep.these00 <-c("Foreign.Born00","Recent.Immigrant00","Poor.English00","Veteran00","Poverty00","Poverty.Black00","Poverty.White00","Poverty.Hispanic00","Pop.Black00","Pop.Hispanic00","Pop.Unemp00","Pop.Manufact00","Pop.SelfEmp00","Pop.Prof00","Female.LaborForce00")

pred00<-predict(mod2, Census2000[keep.these00])

Census2000$PredCluster <- pred00$classification

TransDF2000<-Census2000 %>%
  select(TRTID10, PredCluster)

TransDF2010<-Census2010 %>%
  select(TRTID10, cluster,Median.HH.Value10) 

TransDFnew<-merge(TransDF2000,TransDF2010,by.all="TRTID10",all.x=TRUE)
```


***

Here you can see where the five different clusters reside on a map of Seattle.




Neighborhood Change {.storyboard}
=========================================


### Creating Transition Matrix

```{r ,message=F, warning=F, echo=F, fig.align='center'}

#Transition Matrix
prop.table( table( TransDFnew$PredCluster, TransDFnew$cluster ) , margin=1 )
    
```


***

We can see that most counties remain in the same clustering over the two time periods. This is not super surprising due to the relatively short time frame 2000-2010.




### Neighborhood Transitions

```{r, message=F, warning=F, echo=F, fig.align='center'}

# Sankey Transition Plot
trn_mtrx1 <-
  with(TransDFnew,
       table(PredCluster, 
             cluster))

library(Gmisc)
transitionPlot(trn_mtrx1, 
               type_of_arrow = "gradient")
```

***

In this Sankey diagram we can see the pattern of clusters transitioning to other clusters from 2000 to 2010. Clusters 1, 2, 4, and 5 all tend to stay in the same cluster when advancing 10 years. Cluster 3 tends to split into clusters 3 and 5. A little bit of gentrification is showing where some of clusters 2 and 3 advance to cluster 5.


About {.storyboard}
=========================================





### About the Developer 


![](images/Jason Face.png)

***

Jason Eastman resides in Gilbert, Arizona with his wife and four daughters. He has a Bachelor of Science in Computational Mathematics and is currently attending Arizona State University acquiring a Master's in Program Evaluation and Data Analytics. His hobbies include role playing games, movies, and spending time with his family.

email: jason.eastman\@live.com




### Documentation {data-commentary-width=400}

```{r, eval=F, echo=T}
# R libraries used for this project
library( tidycensus )
library( tidyverse )
library( dplyr )
library( stargazer )
library( corrplot )
library( purrr )
library( flexdashboard )
library( leaflet )
library( DT )
library( geojsonio )   
library( sp )          
library( sf )          
library( mclust )       
library( tmap )        
library( ggplot2 )      
library( ggthemes )    
library( plyr )        
library( pander )      
library( cartogram )   
library( maptools )     
```


***

A US census API key was used in order to download the census information. One must acquire this online in order to download the census information themselves.  All packages used can be found on CRAN. Packages used:

- ```tidycensus```: is an R package that allows users to interface with the US Census Bureau’s decennial Census and five-year American Community APIs and return tidyverse-ready data frames, optionally with simple feature geometry included. 
- ```tidyverse```: is an opinionated collection of R packages designed for data science.
- ```dplyr```: is a grammar of data manipulation, providing a consistent set of verbs that help you solve the most common data manipulation challenges.
- ```stargazer```: Produces LaTeX code, HTML/CSS code and ASCII text for well-formatted tables that hold regression analysis results from several models side-by-side, as well as summary statistics
- ```corrplot```: A graphical display of a correlation matrix or general matrix. It also contains some algorithms to do matrix reordering. In addition, corrplot is good at details, including choosing color, text labels, color labels, layout, etc.
- ```purrr```: A complete and consistent functional programming toolkit for R.
- ```flexdashboard```: Format for converting an R Markdown document to a grid oriented dashboard. The dashboard flexibly adapts the size of it's components to the containing web page.
- ```leaflet```: Create and customize interactive maps using the 'Leaflet' JavaScript library and the 'htmlwidgets' package.
- ```DT```: Data objects in R can be rendered as HTML tables using the JavaScript library 'DataTables'.
- ```geojsonio```: Convert data to 'GeoJSON' or 'TopoJSON' from various R classes, including vectors, lists, data frames, shape files, and spatial classes.
- ```sp```: Classes and methods for spatial data; the classes document where the spatial location information resides, for 2D or 3D data.
- ```sf```: Support for simple features, a standardized way to encode spatial vector data. Binds to 'GDAL' for reading and writing data, to 'GEOS' for geometrical operations, and to 'PROJ' for projection conversions and datum transformations.
- ```mclust```:  Gaussian finite mixture models fitted via EM algorithm for model-based clustering, classification, and density estimation, including Bayesian regularization, dimension reduction for visualisation, and resampling-based inference.
- ```tmap```: Thematic maps are geographical maps in which spatial data distributions are visualized.
- ```ggplot2```: A system for 'declaratively' creating graphics, based on "The Grammar of Graphics". 
- ```ggthemes```: Some extra themes, geoms, and scales for 'ggplot2'.
- ```plyr```: A set of tools that solves a common set of problems.
- ```pander```: Contains some functions catching all messages, 'stdout' and other useful information while evaluating R code and other helpers to return user specified text elements in 'pandoc' markdown or several type of R objects similarly automatically.
transformed to markdown format. 
- ```cartogram```: Construct continuous and non-contiguous area cartograms.
- ```maptools```: Set of tools for manipulating geographic data. It includes binary access to 'GSHHG' shoreline files.